package com.emellend.api11.media;

import com.emellend.api11.R;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
@SuppressWarnings("unused")
public class MediaPlayerDemo extends Activity implements OnClickListener {
	
	private Button mlocalvideo;
	private Button mresourcesvideo;
    private Button mstreamvideo;
    private Button mlocalaudio;
    private Button mresourcesaudio;
    private Button mstreamaudio;
    
    public static final String MEDIA = "media";
    public static final int LOCAL_AUDIO = 1;
    public static final int STREAM_AUDIO = 2;
    public static final int RESOURCES_AUDIO = 3;
    public static final int LOCAL_VIDEO = 4;
    public static final int STREAM_VIDEO = 5;
    public static final int RESOURCES_VIDEO = 6;
    
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.mediaplayer_1);
		findView();
		addListener();
	}
	private void findView() {
		mlocalvideo=(Button) findViewById(R.id.localvideo);
		mlocalaudio=(Button) findViewById(R.id.localaudio);
		mstreamvideo=(Button) findViewById(R.id.streamvideo);
		mresourcesaudio=(Button) findViewById(R.id.resourcesaudio);
	}
	private void addListener() {
		mlocalvideo.setOnClickListener(this);
		mlocalaudio.setOnClickListener(this);
		mstreamvideo.setOnClickListener(this);
		mresourcesaudio.setOnClickListener(this);
	}
	
	@Override
	public void onClick(View v) {
		switch (v.getId()) {
		case R.id.localvideo:
			startActivity(MediaPlayerDemo_Video.class, LOCAL_VIDEO);
			break;
		case R.id.localaudio:
			startActivity(MediaPlayerDemo_Audio.class, LOCAL_AUDIO);
			break;
		case R.id.streamvideo:
			startActivity(MediaPlayerDemo_Video.class, STREAM_VIDEO);
			break;
		case R.id.resourcesaudio:
			startActivity(MediaPlayerDemo_Audio.class, RESOURCES_AUDIO);
			break;
		}
	}
	
	@SuppressWarnings("rawtypes")
	private void startActivity(Class clazz,int extra){
		Intent intent=new Intent(this,clazz);
		intent.putExtra(MEDIA, extra);
		startActivity(intent);
	}
}
